<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>维护BOM信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <#include "${request.contextPath}/common/common.ftl">
</head>
<body>
<div class="splayui-container">
    <div class="splayui-main">
        <form class="layui-form" style="margin: 0 auto;max-width:1200px;padding-top: 40px;">
            <div class="layui-form-item" style="display: flex; align-items: center;">


                <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-workOrderNumber" class="layui-form-label sp-required">工单编号</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-workOrderNumber" name="workOrderNumber" lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.workOrderNumber}">
                    </div>
                </div>


                <!-- 物料编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-pcbCode" class="layui-form-label sp-required">PCB编码</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-pcbCode" name="pcbCode" lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.pcbCode}">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="display: flex; align-items: center;">


                <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-workOrderQuantity" class="layui-form-label sp-required">工单数量</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-workOrderQuantity" name="workOrderQuantity" lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.workOrderQuantity}">
                    </div>
                </div>


                <!-- 物料编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-dateTime" class="layui-form-label sp-required">日期时间</label>
                    <div class="layui-input-inline">
                        <input type="date" id="js-dateTime" name="dateTime" lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.dateTime}"
                               placeholder="请选择日期时间"></input>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="display: flex; align-items: center;">

                <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-qcDescription" class="layui-form-label sp-required">质量控制方面的描述</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-qcDescription" name="qcDescription" lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.qcDescription}">
                    </div>
                </div>
                <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-supervisorSignature1" class="layui-form-label sp-required">主管签名</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-supervisorSignature1" name="supervisorSignature1"
                               lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.supervisorSignature1}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="js-isQualified1" class="layui-form-label sp-required">是否合格</label>
                    <div class="layui-input-block" id="js-isQualified1">
                        <input type="radio" name="isQualified1" value="0" title="是"
                               <#if result.isQualified1 == "0" || !(result??)>checked</#if>>
                        <input type="radio" name="isQualified1" value="1" title="否"
                               <#if result.isQualified1 == "1">checked</#if>>
                    </div>
                </div>

            </div>
            <div class="layui-form-item" style="display: flex; align-items: center;">


                <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-testDescription" class="layui-form-label sp-required">测试方面的描述</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-testDescription" name="testDescription" lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.testDescription}">
                    </div>
                </div>


                <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-supervisorSignature2" class="layui-form-label sp-required">主管签名</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-supervisorSignature2" name="supervisorSignature2"
                               lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.supervisorSignature2}">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label for="js-isQualified2" class="layui-form-label sp-required">是否合格</label>
                    <div class="layui-input-block" id="js-isQualified2">
                        <input type="radio" name="isQualified2" value="0" title="是"
                               <#if result.isQualified2 == "0" || !(result??)>checked</#if>>
                        <input type="radio" name="isQualified2" value="1" title="否"
                               <#if result.isQualified2 == "1">checked</#if>>
                    </div>
                </div>


            </div>
            <div class="layui-form-item" style="display: flex; align-items: center;">


                <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-processDescription" class="layui-form-label sp-required">制程方面的描述</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-processDescription" name="processDescription" lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.processDescription}">
                    </div>
                </div>        <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-supervisorSignature3" class="layui-form-label sp-required">主管签名</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-supervisorSignature3" name="supervisorSignature3"
                               lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.supervisorSignature3}">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label for="js-isQualified3" class="layui-form-label sp-required">是否合格</label>
                    <div class="layui-input-block" id="js-isQualified3">
                        <input type="radio" name="isQualified3" value="0" title="是"
                               <#if result.isQualified3 == "0" || !(result??)>checked</#if>>
                        <input type="radio" name="isQualified3" value="1" title="否"
                               <#if result.isQualified3 == "1">checked</#if>>
                    </div>
                </div>

            </div>
            <div class="layui-form-item" style="display: flex; align-items: center;">


                <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-engineeringDescription" class="layui-form-label sp-required">工程方面的描述</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-engineeringDescription" name="engineeringDescription"
                               lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.engineeringDescription}">
                    </div>
                </div>        <!-- BOM编码 Field -->
                <div class="layui-inline" style="flex: 1; ">
                    <label for="js-supervisorSignature4" class="layui-form-label sp-required">主管签名</label>
                    <div class="layui-input-inline">
                        <input type="text" id="js-supervisorSignature4" name="supervisorSignature4"
                               lay-verify="required"
                               autocomplete="off" class="layui-input" value="${result.supervisorSignature4}">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label for="js-isQualified4" class="layui-form-label sp-required">是否合格</label>
                    <div class="layui-input-block" id="js-isQualified4">
                        <input type="radio" name="isQualified4" value="0" title="是"
                               <#if result.isQualified4 == "0" || !(result??)>checked</#if>>
                        <input type="radio" name="isQualified4" value="1" title="否"
                               <#if result.isQualified4 == "1">checked</#if>>
                    </div>
                </div>
            </div>


            <#--            <div class="layui-form-item">-->
            <#--                <label for="js-is-deleted" class="layui-form-label sp-required">状态-->
            <#--                </label>-->
            <#--                <div class="layui-input-block" id="js-is-deleted" style="width: 310px;">-->
            <#--                    <input type="radio" name="deleted" value="0" title="正常"-->
            <#--                           <#if result.deleted == "0" || !(result??)>checked</#if>>-->
            <#--                    <input type="radio" name="deleted" value="1" title="已删除"-->
            <#--                           <#if result.deleted == "1">checked</#if>>-->
            <#--                    <input type="radio" name="deleted" value="2" title="已禁用"-->
            <#--                           <#if result.deleted == "2">checked</#if>>-->
            <#--                </div>-->
            <#--            </div>-->
            <#--            <div class="layui-form-item">-->
            <#--                <label class="layui-form-label">备注说明:</label>-->
            <#--                <div class="layui-input-block">-->
            <#--                    <textarea placeholder="BOM备注" name="remark" value="${result.remark}"-->
            <#--                              class="layui-textarea"></textarea>-->
            <#--                </div>-->
            <#--            </div>-->
            <div class="layui-form-item layui-hide">
                <div class="layui-input-block">
                    <input id="js-id" name="id" value="${result.id}"/>
                    <button id="js-submit" class="layui-btn" lay-demotransferactive="getData" lay-submit
                            lay-filter="js-submit-filter">确定
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>

    layui.use(['form', 'laydate', 'util', 'layer', 'step', 'spLayer', 'spTable', 'table'], function () {
        var form = layui.form,
            spLayer = layui.spLayer,
            layer = layui.layer,
            table = layui.table, laydate = layui.laydate;
        // 初始化日期时间选择器
        laydate.render({
            elem: '#js-updateTime', // 绑定元素的选择器
            type: 'datetime',       // 选择器类型：datetime表示日期和时间
            format: 'yyyy-MM-dd HH:mm:ss', // 日期格式
            trigger: 'click'        // 触发方式：点击
        });
        //监听提交
        form.on('submit(js-submit-filter)', function (data) {
            spUtil.submitForm({
                url: "${request.contextPath}/technology/bom/add-or-update",
                data: data.field
            });
            return false;
        });

        /**
         * 监听行工具事件
         */
        table.on('tool(js-record-table-filter)', function (obj) {
            // 编辑
            if (obj.event === 'delete') {
                layer.confirm('确认要删除吗？', function (index) {
                    obj.del();
                    layer.close(index);
                })
            }
        })

        // 物料主数据搜索弹框
        $('#js-test-btn').click(function () {
            searchMaterile();
        });
        /**
         * 物料搜索功能
         * @param obj
         */
        window.searchMaterile = function (obj) {
            spLayer.open({
                type: 2,
                area: ['680px', '500px'],
                reload: false,
                content: '${request.contextPath}/admin/common/ui/searchPanelMaterile',
                // 如果是搜索弹窗，需要添加回调函数来获取选中数据
                spCallback: function (result) {
                    if (result.code === 0 && result.data.length > 0) {
                        console.log(result);
                        $('#js-materiel-code').val(result.data[0].materiel);
                        $('#js-materiel-name').val(result.data[0].materielDesc);

                    }
                }
            });
        }
    });

    //版本号
    function FN(btnType) {
        var versionNumber = $('#js-versionNumber')
        if (btnType == 'plus') {
            versionNumber.val(parseInt(versionNumber.val()) + 1);
        } else if (btnType == 'minus') {

            versionNumber.val(parseInt(versionNumber.val()) - 1);
            if (parseInt(versionNumber.val()) <= 0) {
                versionNumber.val('1')
                layer.alert('版本号最小为1', {
                    icon: 2
                });
            }
        }
    }

</script>
</body>
</html>